package com.cloud.basic.Advance.Design.SingletonPattern;

/**
 * @program: basic
 * @description: 双重校验锁
 * @author: Cloud
 * @create: 2022/2/23 15:34:33
 */
public class Singleton4 {
    public static Singleton4 singleton4 = null;

    public Singleton4() {
    }

    public static Singleton4 getInstance() {
        if (singleton4 == null) {
            synchronized (Singleton4.class) {
                if (singleton4 == null) {
                    singleton4 = new Singleton4();
                }
            }
        }
        return singleton4;
    }
}
